package com.wechat.order.platform;

import com.wechat.order.platform.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Created by zzy on 2017/12/24.
 */
@Configuration
@EnableSwagger2
public class WebConfiger extends WebMvcConfigurerAdapter {

   @Bean
    public LoginInterceptor loginInterceptor(){
       return new LoginInterceptor();
   }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor()).addPathPatterns("/seller/**").excludePathPatterns("/fake/weChat/**")
                .excludePathPatterns("phoneversion/getTwoDimension");
        super.addInterceptors(registry);
    }
}
